#include<stdio.h>
#include<string.h>
#include<algorithm>
#define sc scanf
#define pr printf
using namespace std;
const int N=1e7+7;
int day[N];
int book[N];
int ans[2],tail;
int main()
{
	int n,goal,i,left,right;
	sc("%d%d",&n,&goal);getchar();
	for(i=1;i<=n;i++){
		sc("%d",&day[i]);
		book[ day[i] ]=1;
	}
	left=1;right=goal-1;
	while(left<=right){
		if(book[left]&&book[right]){
			for(i=1;i<=n;i++){
				if(day[i]==left||day[i]==right){
					ans[tail++]=i;
					if(tail==2)	break;
				}
			}
			break;
		}
		left++;
		right--;
	}
	pr("%d %d\n",ans[0],ans[1]);
}

